Hi all, thanks to Lionel Davost and Chris Garrard who reply to my question. Unfortunately I didn't fix my problem. from Lionel Davost: I'm a bit at a loss, but I have two ideas: First, you may have to delay a little bit the deletion - as disk access may sometimes be lengthy, AV may try to save the data set before it's completely erased. However, this is unlikely as function calls are mostly synchronous in Avenue. More likely... from Chris Garrard: I wrote a script once where a whole bunch of grids could be overwritten, so instead of deleting datasets, I put this at the beginning of the script: oldGVE = Grid.GetVerify Grid.SetVerify(#GRID_VERIFY_OFF) Basically, this allows ArcView to overwrite existing datasets, no questions asked. (Beware, this could be dangerous!) Then I added this to the end of my script: Grid.SetVerify(oldGVE) This turned off the automatic overwrite, and put the settings back to whatever they were originally. I know this doesn't answer your actual question (I can't remember if I've run into that problem before), but I thought this might be helpful. I also found a message at arcview-l archive at esri web site. It talks about a problem with the 3.0a release that will be fixed with the 3.1(!): >*************************************** >ORIGINAL MESSAGE: > >Date: Thu, 2 Jul 1998 15:45:41 -0400 >From: David Savory >Subject: AV3: Overwriting Grids with Grid.DeleteDataSet > >Hello all, > >This is a plea for help from experienced Spatial Analyst users. > >I am writing a script that creates many grids with the GRID mathematical >instance requests. I need to make sure the some of the intermediate grids >are saved with consistent names so that when I combine them >(aGrid.Combine), the fields in the VAT are named consistently thereby >facilitating database operations. > >THE PROBLEM: > >When I save a grid to disk using aGrid.SaveDataSet(aFileName), >it works fine if the aFileName does not exist. > >If aFileName does exist, SaveDataSet quietly fails and makes the aGrid a >temporary data set with a temporary name (e.g., Grid2). > >This happens even if I delete the grid (Grid and associated GTheme) within >the same script prior to invoking SaveDataSet. However, since the grid was >deleted, the next time I run the script, the SaveDataSet is successful. > >The result of all this is that my grids are only named properly every other >time I run the script. > >I believe there should be a way to save a grid data set to a specific file >name after deleting the existing one. > >THE QUESTION: > >Is there some sort of initialization or update command that I have missed? >Any help on this will be greatly appreciated. I have wasted a lot of time >on this one. > >Will Sum. > >Thanks in Advance, > >Dave > > >............................... >DAVID SAVORY - GIS CONSULTANT >Savory@GISconsulting.com > >3811 Canterbury Rd., Ste. 707 >Baltimore, MD 21218, USA > >******************************************************************* >Hi David, > >I have not had any luck with the procedure you have described and >managed to avoid the problem with a less efficient technique (reclass, >convert to shapefile --- works for my purpose, but would be faster if I >could stop with the grid... the temp grid will disappear in this case). > >I have included a response I got from ESRI and a posting from ArcView-L >(see below). > >Stephen Luzny >GIS Unit >Statistics Branch >Saskatchewan Agriculture and Food > > >********************************************* > >ESRI Response: >-------------------- >Subject: GRID and ArcView > >Hi Stephen, > >The problem you are having with Grid.DeleteDataSet is a known bug and >limitation with ArcView 3.0a. It has been officially documented as a >bug by Redlands, but sounds like it might have been fixed with ArcView >3.1. ArcView 3.1 is currently in Beta2 testing and should be released >sometime this summer. I have included the program developer's notes on >the problem below and he says that for now the only way around the limit >is by using 2 scripts, much like the example you received from the >arcview-l newsgroup. > > >"The behaviour of blowing up is a bug in core ArcView at 3.0a. >I also got the same behavior without the Spatial Analyst loaded >when trying to delete a Shapefile (feature theme). It seems as though >the aView.DeleteTheme request will work fine if there isn't any code >after that statement. If there is, and I mean even if there is just >a MsgBox.Info statement after it, it will blow. Furthermore, the reason > >the av.PurgeObjects does not work is because it is never really >evaluated >until the script that uses it is closed (something that is not widely >known). > >Anyways, I checked this out with Feature and Grid themes at AV3.1 and it > >worked fine, so it looks as though the problem with having anything >after the DeleteTheme request is fixed. However, the logic used in >the script is not going to work, because of the inability of ArcView >to process the av.PurgeObjects until after the script is finished. >Before >the script is entered, AV has a handle on the grid theme and will not >give >up that internal handle until the script is finished. This will have to > >performed in two scripts. > >Known limit." Original message: > Hi all. I have a script avenue that creates grids from tins. > I need to save to disk the grid created with a name defined by the script. > Since the process can be executed more than one time on the same datasets > and I want avoid duplication of data on the disk; thus, if a grid with the > same name already exists, I delete the grid (Grid.DeleteDataSet(gridFn)) > and after that I try to save the temporary grid > (moduloGrid.SaveDataSet(gridFn)) > But the last request fails if have just deleted with the DeleteDataSet > request the old grid (the deleteDataSet request succeeds!). > > this is the script: > .... > ' salvo il grid > nomeGrid = "mod" + idCampagna.SetFormat("d").AsString > gridFn = FileName.Merge(av.GetProject.GetWorkDir.AsString, nomeGrid) > if (File.Exists(gridFn)) then > Grid.DeleteDataSet(gridFn) ' succeed! > end > moduloGrid.SaveDataSet(gridFn) ' fails if the grid has just deleted! > ...